#****************************************************************************
# Makefile for TestModule.
# www.srplab.com
#****************************************************************************
DEBUG          := NO
PROFILE        := NO
#****************************************************************************
CC     := gcc
CXX    := g++
LD     := g++

DEBUG_CFLAGS     := -Wall -Wno-format -g -DDEBUG -DENV_LINUX -DSRPMODULEUSER=\"root\" -DSRPMODULEPASSMD5=\"202cb962ac59075b964b07152d234b70\"
RELEASE_CFLAGS   := -Wall -Wno-unknown-pragmas -Wno-format -O3 -DENV_LINUX -DSRPMODULEUSER=\"root\" -DSRPMODULEPASSMD5=\"202cb962ac59075b964b07152d234b70\"

LIBS	:= -ldl -lpthread -lrt
EXTRA_LIBS := /usr/lib/libstarlib.a /usr/lib/libuuid.a 

DEBUG_CXXFLAGS   := ${DEBUG_CFLAGS}
RELEASE_CXXFLAGS := ${RELEASE_CFLAGS}

DEBUG_LDFLAGS    := -g
RELEASE_LDFLAGS  :=

ifeq (YES, ${DEBUG})
   CFLAGS       := ${DEBUG_CFLAGS}
   CXXFLAGS     := ${DEBUG_CXXFLAGS}
   LDFLAGS      := ${DEBUG_LDFLAGS}
else
   CFLAGS       := ${RELEASE_CFLAGS}
   CXXFLAGS     := ${RELEASE_CXXFLAGS}
   LDFLAGS      := ${RELEASE_LDFLAGS}
endif

ifeq (YES, ${PROFILE})
   CFLAGS   := ${CFLAGS} -pg -O3
   CXXFLAGS := ${CXXFLAGS} -pg -O3
   LDFLAGS  := ${LDFLAGS} -pg
endif

#****************************************************************************
# Makefile code common to all platforms
#****************************************************************************
CFLAGS   := ${CFLAGS}   ${DEFS}
CXXFLAGS := ${CXXFLAGS} ${DEFS}
#****************************************************************************
# include source and paths
#****************************************************************************
INCS := -I/usr/include/starcore -I.
BASICMODULE_MODULE_CXXSRCS := SRPSHtmlEnvEngine_UUIDDef.cpp BasicModule/BasicModule_SHtmlEnvSiteClass_VSBody.cpp BasicModule/BasicModule_SHtmlEnvSiteClass_VSRegSkeleton.cpp BasicModule/BasicModule_VSMain.cpp
BASICMODULE_MODULE_CSRCS := 
#****************************************************************************
BASICMODULE_MODULE_CXXOBJS:= $(BASICMODULE_MODULE_CXXSRCS:%.cpp=%.o)
BASICMODULE_MODULE_COBJS  := $(BASICMODULE_MODULE_CSRCS:%.c=%.o)
#****************************************************************************
CXXOBJS := ${BASICMODULE_MODULE_CXXOBJS}
COBJS := ${BASICMODULE_MODULE_COBJS}
BASICMODULE_MODULE_OBJS := ${BASICMODULE_MODULE_CXXOBJS} ${BASICMODULE_MODULE_COBJS}
#****************************************************************************
# Targets of the build
#****************************************************************************
OBJS_PATH = 
BASICMODULE_MODULE := ../../script/SRPSHtmlEnvEngine/BasicModule.so
all: ${BASICMODULE_MODULE}
#****************************************************************************
# Output
#****************************************************************************
${BASICMODULE_MODULE}: ${BASICMODULE_MODULE_OBJS}
	${LD} -shared -o $@ ${LDFLAGS} ${BASICMODULE_MODULE_OBJS} ${LIBS} ${EXTRA_LIBS}
#****************************************************************************
# common rules
#****************************************************************************
${CXXOBJS} :
	${CXX} -fPIC ${CXXFLAGS} ${INCS} $< -o $@ -c $*.cpp
${COBJS} :
	${CC} -fPIC ${CFLAGS} ${INCS} -o $@ -c $*.c
clean:
	-rm -f core ${CXXOBJS} ${COBJS} ${BASICMODULE_MODULE}

